﻿Imports GBDZafiro

Public Class FrmModulo

    Public Sub New(usuario As String, vigencia As String)

        ' Llamada necesaria para el diseñador.
        InitializeComponent()
        ' Agregue cualquier inicialización después de la llamada a InitializeComponent().

        Dim perfil As New GBDZafiro.Perfil
        perfil.perfil = Login.usuario.perfil
        Login.dtModulos = GBDZafiro.ModuloPerfil.consxPerfil(perfil)
        dehabilitarModulos()
        habilitarModulos()
    End Sub

    Private Sub habilitarModulos()
        For Each ctr As Control In Me.Controls
            For Each drmodulo As DataRow In Login.dtModulos.Rows
                If ctr.Tag = drmodulo("COD_MODULO") Then
                    ctr.Enabled = True
                End If
            Next
        Next
    End Sub

    Private Sub dehabilitarModulos()
        btCompar.Enabled = False
        btContabilidad.Enabled = False
        btInvFac.Enabled = False
        btCuentasxCobrar.Enabled = False
        btCuentasxPagar.Enabled = False
        btReportes.Enabled = False
    End Sub

    Private Sub bt_Click(sender As System.Object, e As System.EventArgs)
        Dim bt As Button = DirectCast(sender, Button)
        Dim oFrmMenu As New FrmMenu(vgCodUsuario, bt.Tag, vgVigencia)
        oFrmMenu.ShowDialog(Me)
    End Sub

    Private Sub btInvFac_Click_1(sender As System.Object, e As System.EventArgs) Handles btInvFac.Click
        bt_Click(sender, e)
    End Sub

   
    Private Sub btCompar_Click(sender As System.Object, e As System.EventArgs) Handles btCompar.Click
        bt_Click(sender, e)
    End Sub

    Private Sub btContabilidad_Click(sender As System.Object, e As System.EventArgs) Handles btContabilidad.Click
        bt_Click(sender, e)
    End Sub

    Private Sub btCuentasxCobrar_Click(sender As System.Object, e As System.EventArgs) Handles btCuentasxCobrar.Click
        bt_Click(sender, e)
    End Sub

    Private Sub btCuentasxPagar_Click(sender As System.Object, e As System.EventArgs) Handles btCuentasxPagar.Click
        bt_Click(sender, e)
    End Sub

    Private Sub btReportes_Click(sender As System.Object, e As System.EventArgs) Handles btReportes.Click
        bt_Click(sender, e)
    End Sub

    Private Sub btHerramienta_Click(sender As System.Object, e As System.EventArgs) Handles btHerramienta.Click
        bt_Click(sender, e)
    End Sub

  
    Private Sub btSalir_Click(sender As System.Object, e As System.EventArgs) Handles BtSalir.Click
        Me.Close()
    End Sub
End Class